Skip to content

fix(registration): prevent stored XSS in registration success message#72

Open
rishab11250 wants to merge 1 commit into
codepvg:mainfrom
rishab11250:fix/stored-xss-registration
Open

fix(registration): prevent stored XSS in registration success message#72
rishab11250 wants to merge 1 commit into
codepvg:mainfrom
rishab11250:fix/stored-xss-registration

Conversation

@rishab11250
Copy link
Copy Markdown

Description

Fix a stored XSS vulnerability in the registration success flow. The
user-controlled name parameter was interpolated into innerHTML
without sanitization, allowing a crafted username to execute arbitrary
JavaScript in the victim's browser.

Fixes #57

Changes Made

  • frontend/registration.html:217-224 — Replaced div.innerHTML with
    safe DOM methods (document.createTextNode + span.textContent) to
    prevent stored XSS while preserving the green-colored username display
    and slide-up animation.
  • package.json — Added prettier as devDependency to ensure CI
    formatting compliance going forward.

Type of Change

  • Bug fix

Testing

  • Tested locally
  • Tested on mobile viewport (if applicable)
  • No console errors introduced

Checklist

  • My code follows the project's coding style
  • I have formatted my code locally using Prettier
  • I have performed a self-review of my code
  • My changes generate no new warnings or errors
  • I have updated documentation if required
  • I have linked the relevant issue

Screenshots / Screen Recording

Visual appearance unchanged — username still displays in green with
the same slide-up animation, but now safely using textContent.

Replace innerHTML with safe DOM methods (createTextNode + textContent)
to prevent stored XSS via crafted username in the registration
success flow.

Also add prettier as devDependency for CI formatting compliance.

Closes codepvg#57
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello! Thank you for your first Pull Request!
We are excited to review your contribution to the CodePVG LeetCode Leaderboard.
Please make sure you have run Prettier on your code locally, as our GitHub Actions will fail if the code is unformatted. A maintainer will review your code soon. Thanks for helping out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stored Cross-Site Scripting via Unsanitized innerHTML in Registration Success Flow

1 participant